home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / var / lib / dpkg / info / module-init-tools.postinst < prev    next >
Encoding:
Text File  |  2007-04-03  |  2.6 KB  |  115 lines

  1. #!/bin/sh -e
  2.  
  3. upgrade_quirks() {
  4.   if dpkg --compare-versions "$2" eq "3.1-pre4-1"; then
  5.     depmod -a || true
  6.   fi
  7.   if dpkg --compare-versions "$2" le "3.2.2-3ubuntu3"; then
  8.     rm -f /etc/modprobe.d/blacklist-pata
  9.   fi
  10.   if dpkg --compare-versions "$2" eq "3.3-pre3-1ubuntu4"; then
  11.     rm -f /etc/modprobe.d/blacklist-ipv6
  12.   fi
  13. }
  14.  
  15. create_etc_modules() {
  16.     if [ ! -e /etc/modules ]; then
  17.     cat <<EOT > /etc/modules
  18. # /etc/modules: kernel modules to load at boot time.
  19. #
  20. # This file contains the names of kernel modules that should be loaded
  21. # at boot time, one per line. Lines beginning with "#" are ignored.
  22.  
  23. EOT
  24.     chmod 644 /etc/modules
  25.     fi
  26. }
  27.  
  28. archmodel() { 
  29.   local arch=$(uname -m)
  30.   case $arch in
  31.   i[0-9]86)    arch=i386 ;;
  32.   x86_64|amd64)    arch=i386 ;;
  33.   arm*)        arch=arm ;;
  34.   mips*)    arch=mips ;;
  35.   # 64 bit variants of some architectures are treated like the 32 bit
  36.   s390x)    arch=s390 ;;
  37.   parisc64)    arch=parisc ;;
  38.   sparc64)    arch=sparc ;;
  39.   # these architectures have variants with wildly different hardware
  40.   ppc64)    arch=powerpc.generic ;;
  41.   ppc|powerpc)
  42.     if [ -f /proc/cpuinfo ]; then
  43.       model=$(sed -ne 's/^machine[[:space:]]*:[[:space:]]*//p' /proc/cpuinfo)
  44.     else
  45.       echo "/proc/cpuinfo does not exist, assuming generic powerpc system"
  46.     fi
  47.     case "$model" in
  48.       Amiga*) arch="powerpc.apus" ;;
  49.       Power*) arch="powerpc.pmac" ;; 
  50.       *)      arch="powerpc.generic" ;;
  51.     esac
  52.     ;;
  53.   m68k)
  54.     if [ -f /proc/hardware ]; then
  55.       model=$(sed -ne 's/^Model:[[:space:]]*//p' /proc/hardware)
  56.     else
  57.       echo "/proc/hardware does not exist, assuming generic m68k system"
  58.     fi
  59.     case "$model" in
  60.       Atari*)        arch="m68k.atari" ;;
  61.       Amiga*)        arch="m68k.amiga" ;;
  62.       *)        arch="m68k.generic" ;;
  63.     esac
  64.     ;;
  65.   esac
  66.  
  67.   echo $arch
  68. }
  69.  
  70. create_arch_symlink() {
  71.   cd /etc/modprobe.d/
  72.  
  73.   model=$(archmodel)
  74.   oldmodel=$model
  75.  
  76.   while [ ! -f arch/$model ]; do
  77.     oldmodel=$model
  78.     model=${oldmodel%.*}.generic
  79.     [ "$model" = "$oldmodel" ] && break
  80.     echo "Configuration for $oldmodel not found, trying $model"
  81.   done
  82.  
  83.   ARCHCONFFILE=arch/$model
  84.   if [ -f $ARCHCONFFILE ]; then
  85.     ln -sf $ARCHCONFFILE arch-aliases
  86.   else
  87.     echo "Architecture-specific config file not found"
  88.   fi
  89. }
  90.  
  91. case "$1" in
  92.     configure)
  93.     upgrade_quirks "$@"
  94.     create_etc_modules
  95.     create_arch_symlink
  96.     ;;
  97.  
  98.     abort-upgrade|abort-remove|abort-deconfigure)
  99.     ;;
  100.  
  101.     *)
  102.     echo "$0 called with unknown argument '$1'" >&2
  103.     exit 1
  104.     ;;
  105. esac
  106.  
  107. # Automatically added by dh_installinit
  108. if [ -x "/etc/init.d/module-init-tools" ]; then
  109.     update-rc.d module-init-tools start 15 S . >/dev/null || exit $?
  110. fi
  111. # End automatically added section
  112.  
  113.  
  114. exit 0
  115.